<?php

/**
 * Project form base class.
 *
 * @package    Amawal Invest
 * @subpackage form
 * @author     kabbad
 * @version    SVN: $Id: sfPropelFormBaseTemplate.php 9304 2008-05-27 03:49:32Z dwhittle $
 */
abstract class BaseFormPropel extends sfFormPropel
{
    public function embedI18n($cultures, $decorator = null)
    {


        $class = $this->getI18nFormClass();
        foreach ($cultures as $culture)
        {
            if(!$this->getI18nModelName($culture)){
                return ;
            }
            $method = sprintf('getCurrent%s', $this->getI18nModelName($culture));
            $i18nObject = $this->object->$method($culture);
            $i18n = new $class($i18nObject);
            unset($i18n['id'], $i18n['culture']);

            $this->embedForm( $culture, $i18n, $decorator );
        }
    }


    public function setup()
    {
    	//var_dump($this->getModelName());exit;
    	//var_dump($this->getI18nModelName());exit;
    	//var_dump($this->getI18nFormClass());exit;
        if( $this->getI18nFormClass() )  {
            $this->embedI18n( array (
            'en','ar',
            ) );
        $this->widgetSchema->setLabel( 'en', 'English' );
        $this->widgetSchema->setLabel( 'ar', 'Arabic' );
        }


    }

}
